home *** CD-ROM | disk | FTP | other *** search
- Path: news.ner.bbnplanet.net!forest!ebromber
- From: ebromber@forest.drew.edu
- Newsgroups: comp.lang.c
- Subject: Why doesn't this work?
- Message-ID: <1996Mar4.161412.137442@forest>
- Date: 4 Mar 96 16:14:12 EST
- Organization: Drew University
-
- Does anyone know why this password program doesn't work properly? And if
- you do know the problem how can I fix it? It rejects every password including
- the real password. The program was compiled using a MS-DOS compiler.
- Thanks in advance.
- ebromber@drew.edu
-
- main();
- { char real[4];
- char pass[100];
- int count=0;
- int i, error;
- char c;
- real[0]='j';real[1]='e';real[2]='r';real[3]='k';
- printf("PASSWORD: ");
- fflush(stdout);
- while (c=getch() !='\n')
- { count++;
- pass[count]=c;
- putch('*');
- }
- if (count!=4) { printf("\nWRONG PASSWORD\n"); main();}
- error=0;
- for (i=0; i<4; i++)
- if (real[i]=pass[i]) error++;
- if (error>0) {printf("\nWRONG PASSWORD\n"); main();}
- }
-
-